package com.wenli.lt.controller;


import com.wenli.lt.entity.Classes;
import com.wenli.lt.service.IClassService;
import com.wenli.lt.util.CommonResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * 班级控制器
 * @author lt
 * @since 2021-03-21
 */
@RestController
@Api(tags="班级")
@RequestMapping("class")
public class ClassController {
    @Autowired
    IClassService iClassService;

    /**
     *
     * 新增班级
     * @param classes
     * @return
     */
    @PostMapping("/addClass")
    @ApiOperation("新增班级")
    public CommonResponse addClass(@RequestBody @ApiParam(name = "Classes", value = "班级")Classes classes){
        if (iClassService.addClass(classes)){
            return new CommonResponse("新增成功");
        }else {
            return new CommonResponse(CommonResponse.ERROR_CODE,"新增出错,请联系管理员!");
        }
    }

}
